Remove the @ts-ignore TODO from the event pipeline in jestUtils - #4460
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review. 📝 WalkthroughSummary by CodeRabbit
WalkthroughChangesGesture handler event wrapping
Merge Risk: ⚪ Minimal · up to This localized cleanup removes a TypeScript suppression and lint issue without changing behavior; no actionable merge-blocking risk remains after normal checks and review. 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
This PR removes a TypeScript suppression (// @ts-ignore TODO) and the associated unsafe double-cast in fireGestureHandler within the Jest utilities, keeping the event pipeline type-safe without altering runtime behavior.
Changes:
- Replaces the suppressed
_.map(wrapWithNativeEvent)+as unknown ascast with a singlemapthat performs one explicit cast per event before wrapping. - Replaces
events.shift()!with array destructuring to avoid a non-null assertion (and the related lint warning). - Updates the iteration to use
restEventsafter extracting the first event.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Description
fireGestureHandlerreused a singlelet _variable for every stage of the event pipeline, so its type was fixed by the first assignment asEventWithoutStates[]. The final_.map(wrapWithNativeEvent)step didn't type-check against it, which was suppressed with// @ts-ignore TODOfollowed by anas unknown asdouble cast.This PR collapses the last two steps into a single map with one honest cast (by that point the pipeline has filled in
stateandoldState), the same pattern the file already uses in the otherwrapWithNativeEventcall sites. Also replacesevents.shift()!with destructuring, which removes ano-non-null-assertionlint warning.No behavior change.
Test plan
yarn ts-checkpasses without the suppressionyarn test— 18 suites, 156 tests pass, including calls tofireGestureHandlerwith an empty event list (the only edge whereshift()could differ)